using UnityEngine;
using UnityEngine.UI;

public class PlayerKick : MonoBehaviour
{
	public Text pLayerName;

	private void Start()
	{
	}

	private void Update()
	{
	}

	public void KickPlayer()
	{
		if ((!PhotonNetwork.isMasterClient || !(Manager.Instance.s_PlayerSetup.photonView.owner.name != pLayerName.text)) && !Manager.Instance.s_PlayerSetup.admin)
		{
			return;
		}
		GameObject[] array = GameObject.FindGameObjectsWithTag("Player");
		GameObject[] array2 = array;
		foreach (GameObject gameObject in array2)
		{
			if (pLayerName.text == gameObject.GetComponent<PhotonView>().photonView.owner.name && gameObject != null)
			{
				gameObject.GetComponent<PlayerSetup>().photonView.RPC("KickPlayer", PhotonTargets.All, pLayerName.text);
			}
		}
		Object.Destroy(base.gameObject);
	}
}
